﻿using Microsoft.Practices.Unity;
using Ymca.Web.Services;
using Ymca.Web.Services.Interfaces;
using Ymca.DataAccess.Interfaces;
using Ymca.DataAccess;

namespace Ymca.Web
{
    public static class ContainerConfig
    {
        public static IUnityContainer Container { get; private set; }

        static ContainerConfig()
        {
            Container = new UnityContainer();
        }

        public static void ConfigurateContainer()
        {
            IDataContext blogDbContext = new DataContext();
            Container.RegisterInstance<IDataContext>(blogDbContext);

            IPostBuilder postBuilder = new PostBuilder();
            Container.RegisterInstance<IPostBuilder>(postBuilder);

            IAttachmentBuilder attachmentBuilder = new AttachmentBuilder();
            Container.RegisterInstance<IAttachmentBuilder>(attachmentBuilder);

            ICommentBuilder commentBuilder = new CommentBuilder();
            Container.RegisterInstance<ICommentBuilder>(commentBuilder);

			IGalleryService galleryService = new GalleryService();
			Container.RegisterInstance<IGalleryService>(galleryService);

            IPostsService postsService = new PostsService();
            Container.RegisterInstance<IPostsService>(postsService);

			ISearchService searchService = new SearchService();
			Container.RegisterInstance<ISearchService>(searchService);

			IContentValuesService contentService = new ContentValuesService();
			Container.RegisterInstance<IContentValuesService>(contentService);

			IUserProfileService userService = new UserProfileService();
			Container.RegisterInstance<IUserProfileService>(userService);

			IAttachmentService attachmentService = new AttachmentService();
			Container.RegisterInstance<IAttachmentService>(attachmentService);
        }

    }
}